package cn.wonderland.netflix.fallback;

import cn.wonderland.netflix.domain.User;
import cn.wonderland.netflix.feign.UserService;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserServiceFallbackFactory implements FallbackFactory<UserService> {
    @Override
    public UserService create(Throwable throwable) {
        return new UserService() {
            @Override
            public User getUser(Long id) {
                return new User(-1L, "进入pay熔断！","服务繁忙，请稍后重试！");
            }
        };
    }
}
